<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:cat="http://tecnologie-web.studenti.math.unipd.it/tecweb/~ccardin/"
    exclude-result-prefixes="cat">
        
<xsl:output method='xml' version='1.0' encoding='UTF-8' indent='yes' omit-xml-declaration='yes'/>
    
    <xsl:template match="/">
        <div id="searchbar">
			<form method="post" action="forumsearch.cgi">
				<div>
					<label for="query">Search:</label>
					<input type="text" id="query" name="query"/>
					<input type="submit" value="Search"/>
				</div>
			</form>
		</div>
        <div id="content-title">
	<h2>
		<span>FORUM</span>
                Share information with the community
		
	</h2>
        __NEW_ALG_LINK__
</div>
        <xsl:apply-templates select="cat:algorithms/cat:category"/>
    </xsl:template>
    
    <xsl:template match="cat:category">
        <div class="content-categories">
                <h3>Subcategories of <xsl:value-of select="cat:nameCategory" /></h3>
                <xsl:variable name="idCat" select="position()" />
                <xsl:for-each select="cat:subCategory">
                    <dl class="content-item">
                        <dd class="item-description"><h4><a href="forumAlgorithms.cgi?cat={$idCat}&amp;subcat={position()}"><xsl:value-of select="cat:nameSubCategory" /></a><br/> <xsl:value-of select="cat:descSubCategory"/></h4></dd>
                        <dd class="item-pos1">Number of Algorithms: <xsl:value-of select="count(.//cat:algorithm)"/></dd>
                        <dd class="item-pos2">Total Comments: <xsl:value-of select="count(.//cat:comment)"/></dd>
                    </dl>
                </xsl:for-each>
            
        </div>
    </xsl:template>
    
</xsl:stylesheet>
